package com.jiulan.hearthearing.ui.heart.adapter;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.jiulan.hearthearing.R;
import com.jiulan.hearthearing.ui.heart.model.CourseListModle;
import com.shehuan.niv.NiceImageView;

import java.util.List;

public class ClassifyAdapter extends BaseQuickAdapter<CourseListModle.DataBean.ListBean, BaseViewHolder> {

    public ClassifyAdapter(List<CourseListModle.DataBean.ListBean> data) {
        super(R.layout.item_classify_course, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, CourseListModle.DataBean.ListBean item) {
        NiceImageView nivPic = helper.getView(R.id.nivPic);
        Glide.with(mContext).asBitmap().load(item.getLecturer().getPic()).override(63, 80).centerCrop().into(nivPic);
        helper.setText(R.id.tvTitle, item.getTitle());
        helper.setText(R.id.tvContent, item.getShort_title());
        helper.setText(R.id.tvAuthor, item.getLecturer().getName() + "·" + item.getLecturer().getTitle());
        helper.setText(R.id.tvPrice, String.valueOf(item.getClass_num()) + "讲/" + String.valueOf(item.getPrice()) + "学习币");
        switch (item.getType()) {
            case 0:
                helper.setText(R.id.tvType, "视频录播");
                break;
            case 1:
                helper.setText(R.id.tvType, "视频直播");
                break;
            case 2:
                helper.setText(R.id.tvType, "电台");
                break;
            case 3:
                helper.setText(R.id.tvType, "文章");
                break;
        }
    }
}
